/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package database;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import oracle.jdbc.pool.OracleDataSource;

public class CreateTableOracle {

    public static void main(String[] args) {
        String jdbcUrl = "jdbc:oracle:thin:@172.23.9.185:1521:orcl";
        String userid = "MHS115314033"; // gantikan dengan username anda
        String password = "MHS115314033"; // gantikan dengan password anda

        Connection conn;
        try {
            OracleDataSource ds;
            ds = new OracleDataSource();
            ds.setURL(jdbcUrl);
            conn = ds.getConnection(userid, password);
            System.out.println("Koneksi is OK");
            Statement statement = conn.createStatement();

            String sql = " CREATE table YUDISIUM ( NAMAMHS VARCHAR2(80) NOT NULL,NIMMHS VARCHAR2(10) NOT NULL, "
                    + "NOMOR_HPMHS VARCHAR2(20) NOT NULL,PRODIMHS VARCHAR2(20) NOT NULL,"
                    + "EMAIL VARCHAR2(20) NOT NULL,"
                    + "PERIODE_BULAN VARCHAR2(20) NOT NULL,"
                    + "PERIODE_HARI VARCHAR2(20) NOT NULL,PERIODE_TANGGAL VARCHAR2(20) NOT NULL,"
                    + "PERSETUJUAN_NILAI VARCHAR2 (20) NOT NULL,PENGESAHAN_SKRIPSI VARCHAR2 (20) NOT NULL,"
                    + "BEBASPINJAM_LAB VARCHAR2 (20) NOT NULL,BEBASPINJAM_DOSEN VARCHAR2 (20) NOT NULL,"
                    + "BUKTI_KP VARCHAR2 (20) NOT NULL,FOTOCOPY_TKBI VARCHAR2 (20) NOT NULL,"
                    + "FOTOCOPY_TA VARCHAR2 (20) NOT NULL,SISTEM_POIN VARCHAR2 (20) NOT NULL,"
                    + "BUKTI_RBM VARCHAR2 (20) NOT NULL,STATUS VARCHAR(20) NOT NULL,"
                    + "constraint YUDISIUM_PK primary key (NIMMHS) ENABLE)";

            statement.executeUpdate(sql);

        } catch (SQLException e) {
// perform error handling here
            System.out.println("error :" + e.getMessage());
        }
    }
}

